fix: flush StreamedLogAsync tail when stop() cancels the task#754
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #754 +/- ##
==========================================
+ Coverage 94.72% 94.74% +0.02%
==========================================
Files 48 48
Lines 5044 5045 +1
==========================================
+ Hits 4778 4780 +2
+ Misses 266 265 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ba41d95 to
5b6a9dd
Compare
5b6a9dd to
8986424
Compare
8986424 to
4101ef4
Compare
janbuchar
approved these changes
May 25, 2026
…op-hang-and-tail-flush # Conflicts: # tests/unit/test_logging.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In
StreamedLogAsync(src/apify_client/_streamed_log.py), shutdown is driven bystop()cancelling the streaming task.CancelledErrorunwinds out of theasync forbefore the trailing_log_buffer_content(include_last_part=True)runs, so whatever sits in the buffer (the tail after the last 8601 marker) is silently discarded.Wrapping the loop in
try/finallyguarantees the tail is flushed even on cancel.A regression test covers the bug.